/*
 * FoldGiveTakeStrategy.java
 *
 * Created on 20 de Abril de 2011, 18:23
 *
 */

package intopo.game.impl.givetake;

import intopo.game.FoldStrategy;
import java.io.PrintStream;

/**
 *
 * @author <a href="mailto:plmariano@ua.pt">Pedro Lopes da Silva Mariano</a>
 *
 * @version 1.0 20 de Abril de 2011
 */
public class FoldGiveTakeStrategy
	implements FoldStrategy<GiveTakeStrategy>
{
	/**
	 * Average time to give the resource.
	 */
	private long averageGive;
	/**
	 * Average time to take the resource.
	 */
	private long averageTake;

	/**
	 * Creates a new instance of FoldGiveTakeStrategy
	 */
	public FoldGiveTakeStrategy ()
	{
		start ();
	}
	public void start ()
	{
		this.averageGive = 0;
		this.averageTake = 0;
	}
	public void apply (GiveTakeStrategy strategy)
	{
		this.averageGive += strategy.averageGive ();
		this.averageTake += strategy.averageTake ();
	}
	public void print (PrintStream ps)
	{
		ps.print (this.averageGive);
		ps.print (' ');
		ps.print (this.averageTake);
	}
}
